<?php

/**
 * 
 * @author 
 * @version 
 *
 */

require_once 'Zend/Controller/Action.php';

class ResourceController extends Zend_Controller_Action
{
	public function init()
	{}

	/**
	 * The default action - show the home page
	 */
	public function indexAction()
	{
		// TODO Guardar limite en la sesion
		$limitSession = 10;
		
		$page = $this->_request->getParam( 'page', 1 );
		$limit = $this->_request->getParam( 'limit', $limitSession );

		$resource = new Bcms_Resource();
		
		$paginate = Zend_Paginator::factory( $resource->getCoreModel()->select() );
		$paginate->setCurrentPageNumber( $page )
				 ->setItemCountPerPage( $limit );
				 
		Zend_View_Helper_PaginationControl::setDefaultViewPartial( 'partials/paginate-resources.phtml' );

		$this->view->resources = $paginate;
	}
	
	public function editAction()
	{}
	
	public function newAction()
	{}
}